As a scanner device that reads an image using an optical unit, a scanner device adopting a contact image sensor (CIS) and a scanner device adopting a charge coupled device (CCD) are known. For the scanner device adopting the CIS, as the document is to be in contact with a reading surface, it is not suitable for reading a three-dimensional object. However, the scanner device adopting the CIS is widely used today as it is thinner and cheaper than that of adopting the CCD and a technique to reduce noises apt to be generated in read image data is improved. For example, the CIS is adopted for reading an image on a back surface of a document in an image reading apparatus capable of reading both sides of images on a document in a single pathway.
Here, for the CIS, light emitting diodes (LEDs) of RGB are used for an optical source where lights of RGB are switched at a high-speed. A light from a document is input to an image sensor (CMOS image sensor) through a lens, and the light input to the image sensor is converted into a voltage value of each pixel to be output.
The scanner device adopting the CIS adopts a contact image sensor where a single line of an image on a document is read with the document being in contact with the sensor by a roller. As it is difficult to form a single long sensor, a reading unit of the CIS is composed of plural short sensors aligned in a longitudinal direction. Therefore, this may cause a certain gap between sensors and an image signal cannot be obtained at the gap. As a result, a pixel with no pixel value (a missing pixel value) is generated.
Although not limited to the scanner device adopting the CIS there may be a situation where image data includes a pixel with a missing pixel value or an incorrect pixel value caused by a deficiency of a sensor reading an image or an obstruction that exists in an optical path such as a contamination on the contact glass on which a document is to be set or the like.
Existence of such a pixel with the missing pixel value or the incorrect pixel value causes a decrease in an image quality. Therefore, a technique to estimate a pixel value of the pixel with the missing pixel value or the incorrect pixel value based on pixel values of surrounding pixels and substituting the missing pixel value or the incorrect pixel value by the estimated value is known.
For example, an interpolation method where a pixel value of a target pixel for which a pixel value is to be supplemented, is estimated by the pixel values of surrounding pixels, such as linear interpolation, polynomial interpolation using plural functions, spline interpolation or the like is known. However, although an interpolation method using the linear interpolation is adaptable to interpolate a pixel value of a pixel included in an area where a variation of gradation is small, the interpolation method is not adaptable for an area where a variation of gradation is large such as a halftone area.
The interpolation method using polynomial interpolation or spline interpolation can estimate a pixel value of a target pixel in an image such as a digital photograph or the like with high accuracy, where a sampling period is short enough with respect to a variation period of the image. However, as for a halftone image, because the resolution of the image may not be defined enough with respect to screen ruling of halftone dots, a sampling period may be ambiguous with respect to a variation period of the image and therefore difficult to estimate an accurate pixel value.
Therefore, in order to solve such a problem by interpolation, a pattern matching method is proposed. With this method, a pixel value of a target pixel in an area having a high frequency (with a short variation period), which is difficult to be estimated by interpolation as described above, can be estimated using a similar pattern positioned near the target pixel.
However, according to the pattern matching method, although an optimum similar pattern for a standard pattern including a target pixel, which is a template, can be obtained, as the similar pattern is selected by using a larger number of pixel values of pixels included in the standard pattern compared with a case using interpolation, the selected similar pattern may not always include an optimum pixel value for the target pixel. This problem occurs because when searching a pattern similar to a standard pattern by pattern matching, a pattern slightly different from the standard pattern as a whole and a pattern a large part of which is the same but including a small part which is largely different from the standard pattern is not discriminated.
Especially, for a halftone area with high screen ruling where only specific pixels have pixel values, the way of selecting a similar pattern has a large influence on the estimation of a pixel value of a target. For a halftone area with a lower concentration, in which a large part of the area is composed of a background, a background area is either detected to be a similar pattern or a similar pattern cannot be detected.
As described above, it may be necessary to use an appropriate method when supplementing a pixel value of a target pixel based on a characteristic of an area including the target pixel.
According to Japanese Patent Number 4330164, device that uses a pattern matching method in which a pattern similar to a target pattern including a target pixel, is selected and a pixel value of a pixel in the selected pattern positioned at a position corresponding to the target pixel is used as an estimated pixel value for the target pixel, when the target pixel is in a halftone area is described.
In the device, whether the target pixel corresponding to a gap between contact image sensors exists in a halftone area or exists in a non-halftone area is determined, then, a pixel value of the target pixel is generated using linear interpolation when the target pixel is determined to exist in the non-halftone area while a pixel value of the target pixel is generated using pattern matching when the target pixel is determined to exist in the halftone area.
At this time, when using pattern matching, a standard block including the target pixel and plural reference blocks having the same size as the standard block, and not including the target pixel, are set in an image near the target pixel. Correlation values between the standard block and each of the reference blocks are calculated based on the pixel values in the standard block and in each of the reference blocks. The reference block, the correlation value for which is the maximum, is selected, and a pixel value of a pixel in the selected reference block corresponding to the target pixel is determined as an estimated pixel value for the target pixel.
However with a supplementing method conventionally known, there is a problem that when a pixel value of a target pixel is not estimated precisely enough, the difference between pixel values of the target pixel and pixels around the target pixel become too large giving a discontinuous image. Further, for a CIS adopting a contact image sensor, the width of a gap between sensors is assumed to be an integral multiple of the width of a pixel although the width of the gap between the sensors may not be an integral multiple of the width of the pixel because of an error in constructing. When such an error occurs, a distortion may be caused between an image area read by one of the sensors and an image area read by another one of the sensors.
For example, when an image including lines drawn parallel to each other are read along a sub scanning direction, the distance between two of the lines where a gap exists between the two lines becomes different from the distances between the other two lines. Further, when an image including a line extending in an inclined direction with respect to the sub scanning direction is read, if an error of the sensors occurs in constructing, the line may shift in the left and the right directions and the upper and the lower directions for each areas of the image data respectively, corresponding to the sensors. For these cases, as the image includes lines extending along the sub scanning direction or the image includes a single line, there is no serious effect on the image quality even if such an error occurs. This is because a number of gaps that cause an influence on the image are not so large and the distortion generated by the gaps may not easy to be found.
However, as for a halftone image, such an error may have serious influence on the image quality. For a halftone image, halftone dots are aligned on lines having a screen angle with respect to the horizontal direction, which is a main scanning direction, with a predetermined period (screen ruling), for example, the screen ruling is approximately 40 to 200 per inch. Especially for an image with high screen ruling, the distance between the halftone dots becomes very close at about 0.1 mm, and construction errors of the sensors cannot be ignored.
Further, when the halftone dot exists at the gap between the sensors, the shape of the halftone dot is altered by the error in constructing and a pixel value of a target pixel having no pixel value because of the gap is difficult to be estimated. Therefore, the estimated pixel value for the target pixel may be different when the pixel value is estimated by the pixels in an area positioned left side of the target pixel and when the pixel value is estimated by the pixels in an area positioned right side of the target pixel. In such a case, it is difficult to find an exact pixel value for the target pixel. Even when an average of such pixel values is supplemented for the target pixel, discontinuity may occur between the target pixel and peripheral pixels of the target pixel.